package com.geekaca.d4.work1;

import java.time.DayOfWeek;
import java.time.LocalDate;

public class Test3 {
    public static void main(String[] args) {
        // 获取当前的日期对象
        LocalDate nowDate = LocalDate.now();
        // 获取今年的天数
        int yearLenth = nowDate.lengthOfYear();

        int Tuesday_COUNT = 0;
        for (int i = 1; i <= yearLenth; i++) {
            // 用Api 获取每天的日期对象
            LocalDate dateTOCheck = nowDate.withDayOfYear(i);
            // 判断每天是否周二
            DayOfWeek dayOfWeek = dateTOCheck.getDayOfWeek();
            if (dayOfWeek.toString() == "TUESDAY") {
                Tuesday_COUNT += 1;
            }


        }
        System.out.printf("今年有%s个星期二 ", Tuesday_COUNT);


    }

}
